package com.jiangxfei.mymvp.app.home.mvp;

import com.jiangxfei.mymvp.app.home.bean.CarBean;
import com.jiangxfei.mymvp.base.BasePersenter;
import com.jiangxfei.mymvp.http.net.OnLoadCallback;

import java.util.List;

import javax.inject.Inject;

/**
 * @author: JiangXFei
 * @date: 2018/1/9 0009
 * @content:
 */

public class HomePresenter extends BasePersenter<HomeConstract.LoadAllModel, HomeConstract.LoadAllView> implements HomeConstract.LoadAllPersenter {


    @Inject
    public HomePresenter(HomeConstract.LoadAllModel loadAllModel, HomeConstract.LoadAllView mLoadAllView) {
        super(loadAllModel, mLoadAllView);
    }

    @Override
    public void loadAll() {
        mModel.loadAll(new OnLoadCallback() {
            @Override
            public void onSuccess(Object o, int resultCode) {

            }

            @Override
            public void onSuccess(Object o, String message, int resultCode) {
                List<CarBean> userList = (List<CarBean>) o;
                if (userList.size() > 0) {
                    mView.loadOnSuccess(userList);
                }
            }

            @Override
            public void onFailure(String msg, int resultCode) {

            }
        });
    }


}
